package com.airbat.prize.common.enums;

import com.airbat.prize.common.core.LongArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 数据类型
 */
@Getter
@AllArgsConstructor
public enum DataTypeEnum implements LongArrayValuable {

    //1案件 2警情 3线索 4人员 5行业领域 6场所

    CASE(1, "案件"),
    CASE_EVIL(11, "黑恶案件"),
    POLICEINFO(2, "警情"),
    CLUE(3, "线索"),
    CLUE_CHILDREN(31, "子线索"),
    PERSON(4, "人员"),
    INDUSTRY(5, "行业领域"),
    PLACE(6, "场所"),
    PLACE_TYPE(61, "场所类型"),
    TAG(7, "标签"),
    COMPANY(8, "企业"),
    COMPANY_PERSON(81, "从业人员"),
    EVENT(9, "事件"),
    COOPERATION(10, "政法协同"),
//    VISIT(11, "回访"),
    CLINIC(21, "医疗"),
    PETITION(22, "信访"),
    VILLAGECADRES(31, "村社干部"),
    OTHER(99, "其他");

    /**
     * 值
     */
    private final long value;
    /**
     * 名称
     */
    private final String name;

    public static final long[] ARRAYS = Arrays.stream(values()).mapToLong(DataTypeEnum::getValue).toArray();

    @Override
    public long[] array() {
        return ARRAYS;
    }

    public static DataTypeEnum getEnum(long value) {
        return Arrays.stream(values()).filter(tr -> tr.getValue() == value).findFirst().get();
    }

}
